package net.crowdloud.client.user;

import java.util.List;

import net.crowdloud.client.GlobalVariables;
import net.crowdloud.shared.engine.CrowdLoudGroupsEngine;
import net.crowdloud.shared.entities.User;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * 
 * @UserManual
 */
public class ButtonListUsers extends Button {

	public ButtonListUsers(final String group) {

		this.setText("List Users");

		this.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {

				List<User> usersGroup = CrowdLoudGroupsEngine.getUsersGroup(
						GlobalVariables.users, group);

				RootPanel.get().clear();
				RootPanel.get().add(new UsersListPage(usersGroup, group));
			}
		});
	}
}
